/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DAO;

import Entity.DomainList;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author THANHDAT
 */
public class DAO_DomainList {

    public DAO_DomainList() {
    }

    public List<DomainList> showDomainList() {
        List<DomainList> lstDomain = new ArrayList<DomainList>();
        String query = "select * from tblDomainList";
        try {
            Statement st = DAO_Connect.getConnection().createStatement();
            ResultSet rs = st.executeQuery(query);
            while (rs.next()) {
                int id = rs.getInt(1);
                String title = rs.getString(2);
                String image = rs.getString(3);
                String content = rs.getString(4);
                DomainList domain = new DomainList(id, title, image, content);
                lstDomain.add(domain);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return lstDomain;
    }

}
